package com.hlhj.carview.module

import android.content.Context
import com.example.mymvp.mvp.BaseModule
import com.hlhj.carview.Iview.MyAdvView
import com.hlhj.carview.bean.AdvListBean
import com.hlhj.carview.http.Apis
import com.hlhj.carview.http.CustomAction
import com.hlhj.carview.http.LoadingAction
import com.lzy.okgo.model.Response

/**
 * Created by Never Fear   on 2018\12\24 0024.
Never More....
 */
class MyAdvModule :BaseModule {
    var lis:MyAdvView?=null

    fun getAdvs(page:String?,c:Context){
        Apis?.getAdv(page)
                ?.let {
                    it.doOnSubscribe(LoadingAction(c))
                            .subscribe(object :CustomAction<Response<AdvListBean>>(c){
                                override fun httpSuccess(t: Response<AdvListBean>) {
                                    lis?.setAdvList(t.body())
                                }
                            })
                }
    }

}